package com.xbongbong.saas.model;

import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.IModel;
import com.xbongbong.saas.domain.entity.WorkOrderStageEntity;

import java.util.List;
import java.util.Map;

/**
 *
 * @author 魏荣杰
 * @date 2019/3/7 10:54
 * @since v1.0
 * @version v1.0
 */
public interface WorkOrderStageModel extends IModel<WorkOrderStageEntity> {
    @Override
    Integer insert(WorkOrderStageEntity entity) throws XbbException;

    @Override
    Integer update(WorkOrderStageEntity entity) throws XbbException;

    @Override
    List<WorkOrderStageEntity> findEntitys(Map<String, Object> param);

    @Override
    Integer getEntitysCount(Map<String, Object> param);

    Integer save(WorkOrderStageEntity entity) throws XbbException;

    Integer delete(Map<String, Object> param);

    WorkOrderStageEntity getNextStage(Map<String, Object> param);

    WorkOrderStageEntity getByKey(Long stageId, String corpid);

    /**
     * 工单阶段列表（模板筛选）
     *
     * @param corpid 公司id
     * @param templateId 模板id
     * @return java.util.List<com.xbongbong.saas.domain.entity.WorkOrderStageEntity>
     * @author 徐俊杰
     * @date 2019/4/22 11:19
     * @since v1.0
     */
    List<WorkOrderStageEntity> workOrderStageListByTemplateId(String corpid, Long templateId);

    WorkOrderStageEntity getPreStage(Map<String,Object> param);

    List<Long> getPreStageList(Map<String,Object> param);

    WorkOrderStageEntity getFirstStage(Long templateId, String corpid);
    /**
     * 批量删除
     * @param list 主键id集合
     * @param corpid
     * @author xingxing.xiao
     */
    Integer deleteBatch(List<Long> list, String corpid);
     void updateBatch(List<WorkOrderStageEntity> entities,String corpid);
}
